<?php echo $this->Session->flash(); ?>
<h1>CARTAS</h1>
<table id="tabla">
    <thead>
        <tr>
            <th>Tipo de carta</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>RESULTADO FASE I</td>
            <td><?php echo $html->link('IMPRIMIR', array('controller' => 'proyects', 'action' => 'result_letter'), array('class' => 'actions', 'target' => '_blank')) ?></td>
        </tr>
        <tr>
            <td>ENCUESTA FASE II A</td>
            <td><?php echo $this->Html->link('IMPRIMIR', array('controller' => 'Polls', 'action' => 'print_poll', $poll_id), array('class' => 'actions', 'target' => 'blank')); ?></td>
        </tr>
        <tr>
            <td>EVALUACIÓN FINAL</td>
            <td><?php echo $this->Html->link('IMPRIMIR', array('controller' => 'FinalEvaluations', 'action' => 'print_letter', $final_evaluation_id), array('class' => 'actions', 'escape' => false, 'target' => 'blank')); ?></td>
        </tr>
        <?php
        $ExisteMuf = false;
        $rutaMuf = APP . "webroot" . "/" . "files" . "/" . $codigo . "/" . 'Muf-' . $codigo . "-" . $final_evaluation_id;
        if (file_exists($rutaMuf . ".xls")) {
            $ExisteMuf = true;
            $rutaMuf = "files" . "/" . $codigo . "/" . 'Muf-' . $codigo . "-" . $final_evaluation_id . ".xls";
        } elseif (file_exists($rutaMuf . "xlsx")) {
            $ExisteMuf = true;
            $rutaMuf = "files" . "/" . $codigo . "/" . 'Muf-' . $codigo . "-" . $final_evaluation_id . ".xlsx";
        }
        ?>
        <tr>
            <td>MODELO UNICO FINANCIERO</td>
            <?php if ($ExisteMuf): ?>
                <td><a href="<?php echo $rutaMuf ?>" target="blank" class="actions" >Descargar MUF</a></td>
            <?php endif; ?>
            <?php if (!$ExisteMuf): ?>
                <td>Archivo no cargado</td>
            <?php endif; ?>
        </tr>
    </tbody>
</table>
